var client = require("../../DAOImpl/mongodb");
var dataConfig = require("../../config/database.json");
var host = dataConfig.host;
var database = dataConfig.db;
var db = new client(host, database);
exports.createDriver = function() {
	var drivers = require("../Dlocation.json");

	for(var driverIP in drivers){
		//console.log(drivers[driverIP]);
		db.insert(dataConfig.col_driver, drivers[driverIP], function(err1, doc){
			if(err1 ){
				console.log(err2);
			}else{
				//console.log(doc);
			}
		});
	}

}

exports.createCustomer = function() {
	console.log('ss');
	var customer = require("../Clocation.json");

	for(var customerIP in customer){
		//console.log(drivers[driverIP]);
		db.insert(dataConfig.col_customer, customer[customerIP], function(err1, doc){
			if(err1 ){
				console.log(err2);
			}else{
				//console.log(doc);
			}
		});
	}

}
exports.createOrder = function(){
	var orders = require("../orders.json");
	//console.log(orders);
	for(var index in orders){
		console.log(index);
		//console.log(index);
		//console.log(orders[index]);
		db.insert(dataConfig.col_order, orders[index], function(err1, doc){
			if(err1){
				console.log(err1);
			}else{
				
				console.log(doc);
			}
			
		});
	}
}
